﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.LightSwitch.ApplicationInfrastructure.Utilities.Internal;

namespace ExtensionsMadeEasy.Navigation.DeepLinkHandlers
{
    public sealed class ScreenDeepLinkHandler : DeepLinkHandler
    {

        private string screenName;
        protected override bool Navigate()
        {
            return this.navigationModel.NavigateTo(this.screenName);
        }

        protected override bool CanNavigate()
        {
            string linkName = null;
            QueryStringHelper.TryGetValue("NavigateTo", out linkName);
            if (!string.IsNullOrEmpty(linkName))
            {
                this.screenName = linkName.ToLower().Replace(" ", "");
                return true;
            }
            return false;
        }
    }
}
